<?php
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/Service/WarehouseService.php';
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/Entity/Domain/WarehouseDomain.php';
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/Context/BaseContext.php';
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../model/ServiceResult/ServiceResult.php';


$warehouseService = new WarehouseService();
$context = new BaseContext();
$result = new ServiceResult();
$warehouseArr = $warehouseService->getAllWarehouse($context, $result);
?>
<script type="text/javascript">
		$(document).ready(function () {
			
			$('#tableWareHouse tr').click(function () {
				var text = $(this).find("td").eq(1).html();
	        	var value = $(this).find("td").eq(0).html();   	
	        	$("#warehouseText").html($.trim(text));
				$("#warehouseValue").attr("value",$.trim(value));
	        	dialog.remove(); 
			});
		});
	</script>
<table border="1" id="tableWareHouse" width="100%">
<?php
foreach ($warehouseArr as $warehouse)
{
	?>
	<tr>
		<td><?php echo $warehouse->getWarehouseID(); ?>
		</td>
		<td><?php echo $warehouse->getWarehouseName() . " - " . $warehouse->getWarehouseAdress(); ?>
		</td>
	</tr>
	<?php
}
?>
</table>
